#include <iostream>
using namespace std;

// 面试题2：实现Singleton模式
template <typename T>
class Singleton {
public:
    static T& getInstance() {
        static T t;
        return t;
    }

    Singleton(const Singleton&) = delete;
    Singleton& operator=(const Singleton&) = delete;

protected:
    Singleton() = default;
    ~Singleton() = default;
};


class Point : public Singleton<Point> {
public:
    void print(int x, int y) {
        cout << x << " " << y << endl;
    }
};

void test() {
    Point& p = Point::getInstance();
    p.print(1,2);
    Point p2;
}

int main(void)
{
    test();
    return 0;
}

